@@ -0,0 +1,20 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 1.11.26 on 2021-07-28 09:18 |
|
| 3 |
+from __future__ import unicode_literals |
|
| 4 |
+ |
|
| 5 |
+from django.db import migrations, models |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+class Migration(migrations.Migration): |
|
| 9 |
+ |
|
| 10 |
+ dependencies = [ |
|
| 11 |
+ ('integral', '0021_auto_20201202_1203'),
|
|
| 12 |
+ ] |
|
| 13 |
+ |
|
| 14 |
+ operations = [ |
|
| 15 |
+ migrations.AddField( |
|
| 16 |
+ model_name='saleclerksubmitloginfo', |
|
| 17 |
+ name='distributor_id', |
|
| 18 |
+ field=models.CharField(blank=True, db_index=True, help_text='\u7ecf\u9500\u5546\u552f\u4e00\u6807\u8bc6', max_length=32, null=True, verbose_name='distributor_id'), |
|
| 19 |
+ ), |
|
| 20 |
+ ] |
@@ -5,7 +5,8 @@ from django.utils.translation import ugettext_lazy as _ |
||
| 5 | 5 |
from django_models_ext import BaseModelMixin, upload_file_path, upload_file_url, upload_path |
| 6 | 6 |
from TimeConvert import TimeConvert as tc |
| 7 | 7 |
|
| 8 |
-from mch.models import ModelInfo |
|
| 8 |
+from mch.models import ModelInfo, DistributorInfo |
|
| 9 |
+from sales.models import SalesResponsibilityInfo |
|
| 9 | 10 |
from utils.qiniucdn import qiniu_file_url |
| 10 | 11 |
|
| 11 | 12 |
|
@@ -86,6 +87,7 @@ class SaleclerkSubmitLogInfo(BaseModelMixin): |
||
| 86 | 87 |
model_uni_name = models.CharField(_(u'model_uni_name'), max_length=255, blank=True, null=True, help_text=u'型号统称') |
| 87 | 88 |
|
| 88 | 89 |
distributor_pk = models.IntegerField(_(u'distributor_pk'), default=0, help_text=u'经销商PK', db_index=True) |
| 90 |
+ distributor_id = models.CharField(_(u'distributor_id'), max_length=32, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True) |
|
| 89 | 91 |
distributor_name = models.CharField(_(u'distributor_name'), max_length=32, blank=True, null=True, help_text=u'经销商名称') |
| 90 | 92 |
|
| 91 | 93 |
clerk_id = models.CharField(_(u'clerk_id'), max_length=32, blank=True, null=True, help_text=u'店员唯一标识', db_index=True) |
@@ -148,6 +150,16 @@ class SaleclerkSubmitLogInfo(BaseModelMixin): |
||
| 148 | 150 |
|
| 149 | 151 |
@property |
| 150 | 152 |
def admindata(self): |
| 153 |
+ try: |
|
| 154 |
+ distributor = DistributorInfo.objects.get(distributor_id=self.distributor_id) |
|
| 155 |
+ sr = SalesResponsibilityInfo.objects.get(sr_id=distributor.sr_id) |
|
| 156 |
+ |
|
| 157 |
+ office = distributor.office |
|
| 158 |
+ sr_name = sr.name |
|
| 159 |
+ except: |
|
| 160 |
+ office = '' |
|
| 161 |
+ sr_name = '' |
|
| 162 |
+ |
|
| 151 | 163 |
return {
|
| 152 | 164 |
'pk': self.pk, |
| 153 | 165 |
'model_name': self.model_name, |
@@ -157,7 +169,10 @@ class SaleclerkSubmitLogInfo(BaseModelMixin): |
||
| 157 | 169 |
'is_staff_delete': self.is_staff_delete, |
| 158 | 170 |
'code_version': self.code_version, |
| 159 | 171 |
'clerk_name': self.clerk_name, |
| 172 |
+ 'distributor_id': self.distributor_id, |
|
| 160 | 173 |
'distributor_name': self.distributor_name, |
| 174 |
+ 'office': office, |
|
| 175 |
+ 'sr_name': sr_name, |
|
| 161 | 176 |
'remark': self.remark, |
| 162 | 177 |
'dupload': self.dupload, |
| 163 | 178 |
'has_scan': self.has_scan, |
@@ -0,0 +1,20 @@ |
||
| 1 |
+# -*- coding: utf-8 -*- |
|
| 2 |
+# Generated by Django 1.11.26 on 2021-07-28 09:18 |
|
| 3 |
+from __future__ import unicode_literals |
|
| 4 |
+ |
|
| 5 |
+from django.db import migrations, models |
|
| 6 |
+ |
|
| 7 |
+ |
|
| 8 |
+class Migration(migrations.Migration): |
|
| 9 |
+ |
|
| 10 |
+ dependencies = [ |
|
| 11 |
+ ('mch', '0061_consumeinfosubmitloginfo_integral'),
|
|
| 12 |
+ ] |
|
| 13 |
+ |
|
| 14 |
+ operations = [ |
|
| 15 |
+ migrations.AddField( |
|
| 16 |
+ model_name='distributorinfo', |
|
| 17 |
+ name='office', |
|
| 18 |
+ field=models.IntegerField(choices=[(-1, '\u672a\u77e5'), (0, '\u5317\u4eac\u6240'), (1, '\u6210\u90fd\u6240'), (2, '\u5e7f\u5dde\u6240'), (3, '\u4e0a\u6d77\u6240'), (4, '\u6b66\u6c49\u6240'), (5, '\u897f\u5b89\u6240')], db_index=True, default=-1, help_text='\u4e8b\u52a1\u6240', verbose_name='office'), |
|
| 19 |
+ ), |
|
| 20 |
+ ] |
@@ -375,6 +375,24 @@ class ModelCameraBodyInfo(BaseModelMixin): |
||
| 375 | 375 |
|
| 376 | 376 |
|
| 377 | 377 |
class DistributorInfo(BaseModelMixin): |
| 378 |
+ DISTRIBOR_OFFICE_UNKNOWN = -1 |
|
| 379 |
+ DISTRIBOR_OFFICE_BEIJING = 0 |
|
| 380 |
+ DISTRIBOR_OFFICE_CHENGDOU = 1 |
|
| 381 |
+ DISTRIBOR_OFFICE_GUANGZHOU = 2 |
|
| 382 |
+ DISTRIBOR_OFFICE_SHANGHAI = 3 |
|
| 383 |
+ DISTRIBOR_OFFICE_WUHAN = 4 |
|
| 384 |
+ DISTRIBOR_OFFICE_XIAN = 5 |
|
| 385 |
+ |
|
| 386 |
+ DISTRIBOR_OFFICE_SPACE = ( |
|
| 387 |
+ (DISTRIBOR_OFFICE_UNKNOWN, u'未知'), |
|
| 388 |
+ (DISTRIBOR_OFFICE_BEIJING, u'北京所'), |
|
| 389 |
+ (DISTRIBOR_OFFICE_CHENGDOU, u'成都所'), |
|
| 390 |
+ (DISTRIBOR_OFFICE_GUANGZHOU, u'广州所'), |
|
| 391 |
+ (DISTRIBOR_OFFICE_SHANGHAI, u'上海所'), |
|
| 392 |
+ (DISTRIBOR_OFFICE_WUHAN, u'武汉所'), |
|
| 393 |
+ (DISTRIBOR_OFFICE_XIAN, u'西安所'), |
|
| 394 |
+ ) |
|
| 395 |
+ |
|
| 378 | 396 |
brand_id = models.CharField(_(u'brand_id'), max_length=32, blank=True, null=True, help_text=u'品牌唯一标识', db_index=True) |
| 379 | 397 |
brand_name = models.CharField(_(u'brand_name'), max_length=255, blank=True, null=True, help_text=u'品牌名称') |
| 380 | 398 |
|
@@ -389,6 +407,7 @@ class DistributorInfo(BaseModelMixin): |
||
| 389 | 407 |
department_id = models.IntegerField(_(u'department_id'), default=-1, help_text=u'企业微信部门ID') |
| 390 | 408 |
department_name = models.CharField(_(u'department_name'), max_length=32, blank=True, help_text=u'企业微信部门名称', db_index=True) |
| 391 | 409 |
sr_id = models.CharField(_(u'sr_id'), max_length=32, blank=True, null=True, help_text=u'销售担当唯一标识', db_index=True) |
| 410 |
+ office = models.IntegerField(_(u'office'), choices=DISTRIBOR_OFFICE_SPACE, default=DISTRIBOR_OFFICE_UNKNOWN, help_text=u'事务所', db_index=True) |
|
| 392 | 411 |
|
| 393 | 412 |
position = models.IntegerField(_(u'position'), default=1, help_text=u'排序') |
| 394 | 413 |
|
@@ -418,6 +437,7 @@ class DistributorInfo(BaseModelMixin): |
||
| 418 | 437 |
'province_code': self.distributor_province_code, |
| 419 | 438 |
'province_name': self.distributor_province_name, |
| 420 | 439 |
'sr_id': self.sr_id, |
| 440 |
+ 'office': self.office, |
|
| 421 | 441 |
} |
| 422 | 442 |
|
| 423 | 443 |
|
@@ -117,6 +117,7 @@ def clerk_sale_submit_api(request): |
||
| 117 | 117 |
model_name=model.model_name, |
| 118 | 118 |
model_uni_name=model.model_uni_name, |
| 119 | 119 |
distributor_pk=distributorID, |
| 120 |
+ distributor_id=distributor.distributor_id, |
|
| 120 | 121 |
distributor_name=distributor.distributor_name, |
| 121 | 122 |
clerk_id=clerk.clerk_id, |
| 122 | 123 |
clerk_name=clerk.clerk_name, |